<template>
  <div>
    <el-dialog title="选择源表单" :visible.sync="formDialog.selectForm" center>
      <el-form style="margin-left: 150px">
        <el-form-item label="文件名称" :label-width="formLabelWidth">
          <el-input v-model="selectFormObj.fileName" readonly style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="选择关联源文件" :label-width="formLabelWidth">
          <el-select   v-model="selectFormObj.parentId"  placeholder="请选择源文件" style="width: 300px">
            <el-option v-if="selectFormObj.fileName!=file.fileName" v-for="file in selectFormInfo" :label="file.fileName" :value="file.id"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="formDialog.selectForm = false">取 消</el-button>
        <el-button type="primary" @click="selectFormModify">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "SelectFormDialog",
    props:{
      formDialog:{type:Object},
      //父组件传递过来的数据
      selectFormObj:{type:Object},
      //父组件传递过来的下拉框的数据
      selectFormInfo:{type:Array},
    },
    data(){
      return{
        formLabelWidth: '120px'
      }
    },
    methods:{
      selectFormModify(){
       this.$emit("selectFormModify",{...this.selectFormObj});
       this.formDialog.selectForm = false;
      },
      // checkSelectForm(){
      //   let obj=this.selectFormInfo.find(item=>{
      //     return item.id==this.selectFormObj.parentId;
      //   });
      //   if(obj.fileName==this.selectFormObj.fileName){
      //     this.selectFormObj.parentId="";
      //   }
      // }
    }
  }
</script>

<style scoped>

</style>
